solving a trigonometric equation on the interval of 0 and 2pi